<html>
<head><meta charset="utf-8"><title>reserved keyword is not a symbol? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html">reserved keyword is not a symbol?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203502197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203502197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ferdia McKeogh <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203502197">(Jul 10 2020 at 12:48)</a>:</h4>
<p>I'm working on this issue: <a href="https://github.com/rust-lang/rust/issues/73948">https://github.com/rust-lang/rust/issues/73948</a>, also discussed here: <a href="https://internals.rust-lang.org/t/is-the-module-name-meta-forbidden/9587">https://internals.rust-lang.org/t/is-the-module-name-meta-forbidden/9587</a>.</p>
<p>I started with the <code>expected_ident_found</code> function in  <code>src/librustc_parse/parser/diagnostics.rs</code> as that is where the hint for escaping keywords is generated, then arriving at <code>src/librustc_span/symbol.rs</code> where it appears keywords and symbols are defined. I removed <code>meta</code> from the <code>Symbols {}</code> identifiers and added it as a keyword:</p>
<div class="codehilite"><pre><span></span><code>        // Edition-specific keywords that are used in stable Rust.
        Async:              &quot;async&quot;, // &gt;= 2018 Edition only
        Await:              &quot;await&quot;, // &gt;= 2018 Edition only
        Dyn:                &quot;dyn&quot;, // &gt;= 2018 Edition only

        // Edition-specific keywords that are used in unstable Rust or reserved for future use.
        Try:                &quot;try&quot;, // &gt;= 2018 Edition only
        Meta:               &quot;meta&quot;, // &gt;= 2018 Edition only
</code></pre></div>


<p>However, this then generates errors in <code>src/librustc_expand/mbe/macro_parser.rs</code> because the meta symbol can no longer be found in rustc_span::sym::*, as explained by the comment. However I am now confused as this "meta" seems to be referring to meta items for Attributes (<a href="https://doc.rust-lang.org/reference/attributes.html">https://doc.rust-lang.org/reference/attributes.html</a>), which is not the "meta" I wanted to change the behaviour of. Does anyone know where I'm going wrong or maybe some pointers as to what fixing this issue would involve?</p>



<a name="203502812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203502812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203502812">(Jul 10 2020 at 12:56)</a>:</h4>
<p>keywords are in the <code>rustc_span::kw::*</code> namespace, not in <code>sym::</code>, I recently tripped over this, too</p>



<a name="203503723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203503723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ferdia McKeogh <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203503723">(Jul 10 2020 at 13:05)</a>:</h4>
<p>Thank you!</p>



<a name="203574947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203574947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203574947">(Jul 11 2020 at 01:54)</a>:</h4>
<p>wait, we didn't actually discuss that issue</p>



<a name="203574955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203574955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203574955">(Jul 11 2020 at 01:54)</a>:</h4>
<p>I doubt any solution will involve keywords, that's a pretty big hammer</p>



<a name="203575110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203575110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203575110">(Jul 11 2020 at 01:58)</a>:</h4>
<p><span class="user-mention" data-user-id="219904">@Ferdia McKeogh</span> left a comment <a href="https://github.com/rust-lang/rust/issues/73948#issuecomment-656966282">https://github.com/rust-lang/rust/issues/73948#issuecomment-656966282</a></p>



<a name="203575122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203575122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203575122">(Jul 11 2020 at 01:59)</a>:</h4>
<p>wait, the thread is from March <em>2019</em>?</p>



<a name="203575226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203575226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203575226">(Jul 11 2020 at 02:02)</a>:</h4>
<p><span class="user-mention" data-user-id="218608">@yodal</span> ^^ how did you stumble over that?</p>



<a name="203579977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203579977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203579977">(Jul 11 2020 at 04:26)</a>:</h4>
<p>Someone posted a link on r/reddit, and no one had made an issue</p>



<a name="203580073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203580073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203580073">(Jul 11 2020 at 04:29)</a>:</h4>
<p>aaaah</p>



<a name="203580075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203580075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203580075">(Jul 11 2020 at 04:29)</a>:</h4>
<p>(that would be useful to know :P)</p>



<a name="203580143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203580143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203580143">(Jul 11 2020 at 04:31)</a>:</h4>
<p><span class="user-mention" data-user-id="218608">@yodal</span> this? <a href="https://www.reddit.com/r/rust/comments/fekol0/naming_a_module_meta_results_in_weird_behavior_i/">https://www.reddit.com/r/rust/comments/fekol0/naming_a_module_meta_results_in_weird_behavior_i/</a></p>



<a name="203580148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203580148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203580148">(Jul 11 2020 at 04:31)</a>:</h4>
<p>looks like there's not much to add</p>



<a name="203580187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203580187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203580187">(Jul 11 2020 at 04:32)</a>:</h4>
<p>everyone seems aware <code>mod meta</code> isn't the problem, just the import</p>



<a name="203580201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203580201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203580201">(Jul 11 2020 at 04:33)</a>:</h4>
<p><span class="user-mention" data-user-id="218608">@yodal</span> ah I see what you edited, thanks!</p>



<a name="203580251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203580251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203580251">(Jul 11 2020 at 04:34)</a>:</h4>
<p><span class="user-mention" data-user-id="218608">@yodal</span> btw, "root of the crate" is misleading, it's actually <code>mod meta {...} use meta::*;</code> anywhere in the code, since that path feature is relative to the current module, not the root of the crate like in Rust 2015</p>



<a name="203581016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/reserved%20keyword%20is%20not%20a%20symbol%3F/near/203581016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/reserved.20keyword.20is.20not.20a.20symbol.3F.html#203581016">(Jul 11 2020 at 04:59)</a>:</h4>
<p>Very true, I'll update that in a bit</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>